<?php if (!empty($this->messages)): ?> 
<?php foreach ($this->messages as $type => $messages): ?> 
<div class="alert alert-<?php echo $type; ?>">
    <?php foreach ($messages as $message): ?> 
    <?php echo $message; ?>
    <?php endforeach; ?> 
</div>
<?php endforeach; ?> 
<?php endif; ?> 